package io.renren.modules.category.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.ConvertUtils;
import io.renren.modules.category.dao.TCategoryDao;
import io.renren.modules.category.dto.TCategoryDTO;
import io.renren.modules.category.entity.TCategoryEntity;
import io.renren.modules.category.service.TCategoryService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 商品品类类目
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2023-08-10
 */
@Service
public class TCategoryServiceImpl extends CrudServiceImpl<TCategoryDao, TCategoryEntity, TCategoryDTO> implements TCategoryService {

    @Override
    public QueryWrapper<TCategoryEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<TCategoryEntity> wrapper = new QueryWrapper<>();
        wrapper.orderByAsc("sort");
        return wrapper;
    }

    @Override
    public List<TCategoryEntity> selectList(Map<String, Object> params){
        List<TCategoryEntity> entityList = baseDao.selectList(getWrapper(params));
        return ConvertUtils.sourceToTarget(entityList, TCategoryEntity .class);
    }


}